from pgmpy.base import DAG

G = DAG()
G.add_nodes_from(nodes=['a', 'b', 'c'])
G.add_edges_from(ebunch=[('a', 'b'), ('b', 'c')])
print('a' in G )
print(f'Numbers of nodes={len(G)}')

student = DAG()
student.add_nodes_from(['diff', 'intel', 'grades'])
student.add_edges_from([('diff', 'grades'), ('intel', 'grades')])
print(student.active_trail_nodes('diff'))
#{'diff': {'diff', 'grades'}}
print(student.active_trail_nodes(['diff', 'intel'], observed='grades'))
#{'diff': {'diff', 'intel'}, 'intel': {'diff', 'intel'}}